/*
 * @(#)ApplicationExceptionList.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.framework;

import java.util.ArrayList;
import java.util.List;

/**
  ApplicationExceptionList.java

  This class is to keep the application error in array format.

    @author          Rollo Chan
    @company         DCIVision Limited
    @creation date   14/08/2003
    @version         $Revision: 1.3 $
*/

public class ApplicationExceptionList extends ApplicationException {

  public static final String REVISION = "$Revision: 1.3 $";

  List listException = null;

  public ApplicationExceptionList() {
    listException = new ArrayList();
  }

  public void addException(ApplicationException ex) {
    listException.add(ex);
  }

  public void addException(int idx, ApplicationException ex) {
    listException.add(idx, ex);
  }

  public void removeException(int idx) {
    listException.remove(idx);
  }

  public ApplicationException[] getExceptionArray() {
    ApplicationException[] result = new ApplicationException[this.listException.size()];
    for (int i = 0; i < this.listException.size(); i++) {
      result[i] = (ApplicationException)this.listException.get(i);
    }
    return(result);
  }

  public void throwException() throws ApplicationException {
    if (this.listException != null && this.listException.size() > 0) {
      throw this;
    }
  }
}